#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long LL;
const LL MAXN=1e3;
LL C[MAXN][MAXN];
LL dp[MAXN][MAXN];
void Init() {
	memset(C, 0, sizeof(C));
	for (int i=0; i<MAXN; ++i) {
		C[i][0]=1; C[i][i]=1;
		for (int j=1; j<i; ++j) {
			C[i][j]=C[i-1][j-1]+C[i-1][j];
		}
	}
	memset(dp, 0, sizeof(dp));
	dp[0][0]=1;
	for (int j=1; j<MAXN; ++j) {
		dp[j][0]=0;
		for (int i=1; i<=j; ++i) {
			for (int k=1; k<=j-i+1; ++k) {
				dp[i][j]+=C[j][k]*dp[i-1][j-k];
			}
		}
	}
}
int main() {
	Init();
	LL n,p;
	while (cin>>n>>p) {
		cout<<dp[p][n]<<endl;
	}
	return 0;
}
